package com.transaction.demo.notify.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.transaction.demo.common.util.Result;
import com.transaction.demo.common.util.ResultPage;
import com.transaction.demo.notify.vo.req.NotifyRecordReqVo;
import com.transaction.demo.notify.vo.req.NotifyRecordListReqVo;
import com.transaction.demo.notify.vo.req.NotifyRecordAddReqVo;
import com.transaction.demo.notify.vo.req.NotifyRecordUpdateReqVo;
import com.transaction.demo.notify.vo.resp.NotifyRecordRespVo;
import com.transaction.demo.notify.service.NotifyRecordService;

/**
 * 描述：通知记录表 RP_NOTIFY_RECORD
 * 作者：马庆智
 * 日期：2023/04/27 17:18:42
 */
@Api(tags = "通知记录表")
@RestController
@RequestMapping("/notifyRecord")
public class NotifyRecordController {

   @Autowired
   private NotifyRecordService notifyRecordService;

   /**
    * 查询通知记录表 RP_NOTIFY_RECORD
    *
    * @param record 请求参数
    * @return NotifyRecordResp
    * @author 马庆智
    * @date: 2023/04/27 17:18:42
    */
   @ApiOperation("查询通知记录表 RP_NOTIFY_RECORD")
   @PostMapping("/queryNotifyRecord")
   public NotifyRecordRespVo query(@RequestBody @Valid NotifyRecordReqVo record){
       return notifyRecordService.queryNotifyRecord(record);
   }

   /**
    * 查询通知记录表 RP_NOTIFY_RECORD列表
    *
    * @param record 请求参数
    * @return NotifyRecordResp
    * @author 马庆智
    * @date: 2023/04/27 17:18:42
    */
   @ApiOperation("查询通知记录表 RP_NOTIFY_RECORD列表")
   @PostMapping("/queryNotifyRecordList")
   public Result<ResultPage<NotifyRecordRespVo>> queryNotifyRecordList(@RequestBody @Valid NotifyRecordListReqVo record){
        return Result.success(notifyRecordService.queryNotifyRecordList(record));
   }

   /**
    * 添加通知记录表 RP_NOTIFY_RECORD
    *
    * @param record 请求参数
    * @return Result<Integer>
    * @author 马庆智
    * @date: 2023/04/27 17:18:42
    */
   @ApiOperation("添加通知记录表 RP_NOTIFY_RECORD")
   @PostMapping("/saveNotifyRecord")
   public Result<NotifyRecordRespVo> saveNotifyRecord(@RequestBody @Valid NotifyRecordAddReqVo record){
        return Result.success(notifyRecordService.saveNotifyRecord(record));
   }

   /**
    * 删除通知记录表 RP_NOTIFY_RECORD
    *
    * @param ids 请求参数
    * @return Result<Integer>
    * @author 马庆智
    * @date: 2023/04/27 17:18:42
    */
   @ApiOperation("删除通知记录表 RP_NOTIFY_RECORD")
   @PostMapping("/deleteNotifyRecord")
   public Result<Integer> deleteNotifyRecord(String ids){
        return Result.success(notifyRecordService.deleteNotifyRecord(ids));
   }

   /**
    * 更新通知记录表 RP_NOTIFY_RECORD
    *
    * @param record 请求参数
    * @return Result<Integer>
    * @author 马庆智
    * @date: 2023/04/27 17:18:42
    */
   @ApiOperation("更新通知记录表 RP_NOTIFY_RECORD")
   @PostMapping("/updateNotifyRecord")
   public Result<Integer> updateNotifyRecord(@RequestBody @Valid NotifyRecordUpdateReqVo record){
        return Result.success(notifyRecordService.updateNotifyRecord(record));
   }

}